using AiQiuQuan.Sport.Model.Enums;

namespace AiQiuQuan.Sport.Model.Models
{
    /// <summary>
    /// 比赛dto
    /// </summary>
    public class GameDto : BaseDto
    {
        /// <summary>
        /// 比赛名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 比赛类型：1水平比赛、2年龄比赛、3团体比赛
        /// </summary>
        public int Type { get; set; }

        /// <summary>
        /// 所属省
        /// </summary>
        public Guid? FollowProvinceId { get; set; }

        /// <summary>
        /// 所属省
        /// </summary>
        public string? FollowProvinceName { get; set; }

        /// <summary>
        /// 所属市
        /// </summary>
        public Guid? FollowCityId { get; set; }

        /// <summary>
        /// 所属市
        /// </summary>
        public string? FollowCityName { get; set; }

        /// <summary>
        /// 省
        /// </summary>
        public Guid? ProvinceId { get; set; }

        /// <summary>
        /// 省
        /// </summary>
        public string? ProvinceName { get; set; }

        /// <summary>
        /// 市
        /// </summary>
        public Guid? CityId { get; set; }

        /// <summary>
        /// 市
        /// </summary>
        public string? CityName { get; set; }

        /// <summary>
        /// 场馆ID
        /// </summary>
        public Guid VenueId { get; set; }

        /// <summary>
        /// 场馆名称
        /// </summary>
        public string VenueName { get; set; }

        /// <summary>
        /// 纬度
        /// </summary>
        public decimal Lat { get; set; }

        /// <summary>
        /// 经度
        /// </summary>
        public decimal Lng { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTimeOffset StartDate { get; set; }

        /// <summary>
        /// 开始时间:08:00
        /// </summary>
        public string StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public string EndTime { get; set; }

        /// <summary>
        /// 小组赛角逐名次：1，2
        /// </summary>
        public int GroupRank { get; set; }

        /// <summary>
        /// 淘汰赛角逐名次：2，4
        /// </summary>
        public int KnockoutRank { get; set; }

        /// <summary>
        /// 最大参赛队伍数
        /// </summary>
        public int LimitCount { get; set; }

        /// <summary>
        /// 比赛图片
        /// </summary>
        public string ImgUrl { get; set; }

        /// <summary>
        /// 价格
        /// </summary>
        public decimal Price { get; set; }

        /// <summary>
        /// 活动状态：1报名中、3进行中、4已结束、9已取消
        /// </summary>
        public GameStateEnum State { get; set; }

        /// <summary>
        /// 组织者
        /// </summary>
        public string Host { get; set; }

        /// <summary>
        /// 组织者电话
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        /// 组织者图片
        /// </summary>
        public string Logo { get; set; }

        /// <summary>
        /// 比赛说明
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 对阵类型，JSON数组：1单打、2双打、3男单、4女单、5男双、6女双、7混双
        /// </summary>
        public string VersusType { get; set; }

        /// <summary>
        /// 对阵类型列表
        /// </summary>
        public List<GameVersusEnum> VersusTypeList => System.Text.Json.JsonSerializer.Deserialize<List<GameVersusEnum>>(VersusType);

        /// <summary>
        /// 网球水平，0不限制
        /// </summary>
        public decimal TennisLevel { get; set; }

        /// <summary>
        /// 年龄
        /// </summary>
        public int Age { get; set; }

        /// <summary>
        /// 0男、1女、2混合、3不限
        /// </summary>
        public GameSexEnum GameSex { get; set; }

        /// <summary>
        /// 双打是否一块报名
        /// </summary>
        public bool IsTogether { get; set; }

        /// <summary>
        /// 距离
        /// </summary>
        public double Distance { get; set; }

        /// <summary>
        /// 报名队伍数量
        /// </summary>
        public int JoinTeamCount { get; set; }

        /// <summary>
        /// 队伍队列
        /// </summary>
        public List<GameTeamDto> TeamList { get; set; }

        /// <summary>
        /// 比赛限制总队伍数，显示用
        /// </summary>
        public int ShowTeamCount => IsTogether ? LimitCount : LimitCount * 2;

        /// <summary>
        /// 参加队伍信息，只有查询自己参加比赛有时有值
        /// </summary>
        public GameTeamDto Team { get; set; }
    }
}
